package main

import "fmt"

type Animal interface {
	Eat()
	Sleep()
}

type Animal2 interface {
	fly()
}

type Dog interface {
	Animal
}

type Bird interface {
	Animal
	Animal2
}

type GeneralUser interface {
	Login()
	Logout()
}
type User interface {
	GeneralUser
}
type VIPUser interface {
	GeneralUser
	TeleConsulTation()
}

type UserImpl struct {
	Name string
}

func (u UserImpl) Login() {
	fmt.Println("用户已登录", u.Name)
}
func (u UserImpl) Logout() {
	fmt.Println("用户已登出", u.Name)
}

type VIPUserImpl struct {
	Name string
}

func (u VIPUserImpl) Login() {
	fmt.Println("VIP用户已登录", u.Name)
}
func (u VIPUserImpl) Logout() {
	fmt.Println("VIP用户已登出", u.Name)
}
func (u VIPUserImpl) TeleConsulTation() {
	fmt.Println("VIP用户已开启远程视频咨询", u.Name)
}
func main() {
	//提高代码的复用性
	// 实现接口隔离
	// 简化接口的使用
	var userInterface User
	var u UserImpl
	u.Name = "杨旭"
	userInterface = u
	userInterface.Login()
	var vipUserInterface VIPUser
	var vip VIPUserImpl
	vip.Name = "杨旭VIP"
	vipUserInterface = vip
	vipUserInterface.Login()
	vipUserInterface.TeleConsulTation()
}
